The source data for our application is the R data set "island" which provides islands size in thousand square miles:
June 8, 2019
The source data for our application is the R data set "island" which provides islands size in thousand square miles:
Our Shiny interface takes two input:
1. The dream destination island, in variable inputValue selectInput('inputValue' , 'Pick up your favorite destination' , names(islands) , selected = "Tasmania")
2. The area unit to convert the island size, in variable conversion radioButtons('conversion' , 'Choose the unit to convert the Island Size into' , c("Acre"=1 , "Hectare"=2 , "Square Kilometer"=3 , "Number of Football Field"=4)
The Shiny server uses a conversion table based on square miles. For example, 1 square miles represents 484 football fields.
t(conversions)
Acres Hectares Square Kilometers Number of Football Fields [1,] 640 258.999 2.589 484
The server reactively returns three variables to the interface:
1. island: The island name output$island <- renderPrint({ input$inputValue })
2. size: the size in square miles calculated in a reactive function output$size <- renderPrint({ mySizeFun() })
3. convertedSize: the size converted into selected area unit output$convertedSize <- renderPrint({ myConvertedSizeFun() })
According to Wikipedia, the size of Sumatra is 473,481 square kilometers.
Go and check whether the approximate converted size calculated by 'myConvertedSizeFun()' matches the value from the encyclopedia using The Destination Island Application
Source for this presentation and the application on GitHub: https://github.com/GenFrenot/Shiny